<?php

namespace App\Http\Resources\Apps;

use App\Models\AppUser;
use Illuminate\Http\Resources\Json\JsonResource;

class UserInfoResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id'    => $this['id'],
            'mobile'=> $this['mobile'],
            'nickname'  => $this['nickname'],
            'icon'  => $this['icon'],
            'integral'  => $this['integral'],
            'balance'   => $this['balance'],
            'bank'      => $this['bank'],
            'invite'    => collect($this['invite_user'])->only([
                'mobile','nickname'
            ]),
        ];
    }
}
